export default function filterData(arr) {
    let userInfo =localStorage.userInfo
    if (!userInfo) return arr
    userInfo = JSON.parse(userInfo)
    const {role} = userInfo
    return arr.filter(item => !item.roles || item.roles.includes(role)).map(item => {
        const tempObj = {...item}
        if (tempObj.children) {
            tempObj.children = filterData(tempObj.children)
        }
        return tempObj
    })
}